package o;

import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;

public final class fuc {
    public static final fuc ˋ = new c().ˎ().ˊ();
    public static final fuc ˎ = new c().ॱ().ˏ(ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, TimeUnit.SECONDS).ˊ();
    private final int ʻ;
    private final boolean ʼ;
    private final boolean ʽ;
    @Nullable
    String ˊ;
    private final int ˊॱ;
    private final boolean ˋॱ;
    private final boolean ˏ;
    private final int ˏॱ;
    private final boolean ͺ;
    private final boolean ॱ;
    private final boolean ॱˊ;
    private final boolean ॱॱ;
    private final int ᐝ;

    public static final class c {
        boolean ʼ;
        boolean ʽ;
        boolean ˊ;
        int ˋ = -1;
        boolean ˎ;
        int ˏ = -1;
        int ॱ = -1;
        boolean ॱॱ;

        public c ˎ() {
            this.ˎ = true;
            return this;
        }

        public c ˏ(int i, TimeUnit timeUnit) {
            if (i < 0) {
                throw new IllegalArgumentException("maxStale < 0: " + i);
            }
            int i2;
            long toSeconds = timeUnit.toSeconds((long) i);
            if (toSeconds > 2147483647L) {
                i2 = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
            } else {
                i2 = (int) toSeconds;
            }
            this.ˋ = i2;
            return this;
        }

        public c ॱ() {
            this.ʼ = true;
            return this;
        }

        public fuc ˊ() {
            return new fuc(this);
        }
    }

    private fuc(boolean z, boolean z2, int i, int i2, boolean z3, boolean z4, boolean z5, int i3, int i4, boolean z6, boolean z7, boolean z8, @Nullable String str) {
        this.ˏ = z;
        this.ॱ = z2;
        this.ʻ = i;
        this.ᐝ = i2;
        this.ॱॱ = z3;
        this.ʽ = z4;
        this.ʼ = z5;
        this.ˊॱ = i3;
        this.ˏॱ = i4;
        this.ॱˊ = z6;
        this.ˋॱ = z7;
        this.ͺ = z8;
        this.ˊ = str;
    }

    fuc(c cVar) {
        this.ˏ = cVar.ˎ;
        this.ॱ = cVar.ˊ;
        this.ʻ = cVar.ॱ;
        this.ᐝ = -1;
        this.ॱॱ = false;
        this.ʽ = false;
        this.ʼ = false;
        this.ˊॱ = cVar.ˋ;
        this.ˏॱ = cVar.ˏ;
        this.ॱˊ = cVar.ʼ;
        this.ˋॱ = cVar.ʽ;
        this.ͺ = cVar.ॱॱ;
    }

    public boolean ˎ() {
        return this.ˏ;
    }

    public boolean ॱ() {
        return this.ॱ;
    }

    public int ˏ() {
        return this.ʻ;
    }

    public boolean ˋ() {
        return this.ॱॱ;
    }

    public boolean ˊ() {
        return this.ʽ;
    }

    public boolean ʽ() {
        return this.ʼ;
    }

    public int ʻ() {
        return this.ˊॱ;
    }

    public int ᐝ() {
        return this.ˏॱ;
    }

    public boolean ʼ() {
        return this.ॱˊ;
    }

    public static fuc ˏ(fui o_fui) {
        String ˋ;
        boolean z = false;
        int i = -1;
        int i2 = -1;
        boolean z2 = false;
        boolean z3 = false;
        boolean z4 = false;
        int i3 = -1;
        int i4 = -1;
        boolean z5 = false;
        boolean z6 = false;
        boolean z7 = false;
        Object obj = 1;
        int ˋ2 = o_fui.ˋ();
        int i5 = 0;
        String str = null;
        boolean z8 = false;
        while (i5 < ˋ2) {
            boolean z9;
            String ॱ = o_fui.ॱ(i5);
            ˋ = o_fui.ˋ(i5);
            if (ॱ.equalsIgnoreCase("Cache-Control")) {
                if (str != null) {
                    obj = null;
                } else {
                    str = ˋ;
                }
            } else if (ॱ.equalsIgnoreCase("Pragma")) {
                obj = null;
            } else {
                z9 = z8;
                i5++;
                z8 = z9;
            }
            z9 = z8;
            int i6 = 0;
            while (i6 < ˋ.length()) {
                String str2;
                int ˎ = fvr.ˎ(ˋ, i6, "=,;");
                String trim = ˋ.substring(i6, ˎ).trim();
                if (ˎ == ˋ.length() || ˋ.charAt(ˎ) == ',' || ˋ.charAt(ˎ) == ';') {
                    i6 = ˎ + 1;
                    str2 = null;
                } else {
                    i6 = fvr.ˎ(ˋ, ˎ + 1);
                    String trim2;
                    if (i6 >= ˋ.length() || ˋ.charAt(i6) != '\"') {
                        ˎ = fvr.ˎ(ˋ, i6, ",;");
                        trim2 = ˋ.substring(i6, ˎ).trim();
                        i6 = ˎ;
                        str2 = trim2;
                    } else {
                        i6++;
                        ˎ = fvr.ˎ(ˋ, i6, "\"");
                        trim2 = ˋ.substring(i6, ˎ);
                        i6 = ˎ + 1;
                        str2 = trim2;
                    }
                }
                if ("no-cache".equalsIgnoreCase(trim)) {
                    z9 = true;
                } else if ("no-store".equalsIgnoreCase(trim)) {
                    z = true;
                } else if ("max-age".equalsIgnoreCase(trim)) {
                    i = fvr.ˏ(str2, -1);
                } else if ("s-maxage".equalsIgnoreCase(trim)) {
                    i2 = fvr.ˏ(str2, -1);
                } else if ("private".equalsIgnoreCase(trim)) {
                    z2 = true;
                } else if ("public".equalsIgnoreCase(trim)) {
                    z3 = true;
                } else if ("must-revalidate".equalsIgnoreCase(trim)) {
                    z4 = true;
                } else if ("max-stale".equalsIgnoreCase(trim)) {
                    i3 = fvr.ˏ(str2, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
                } else if ("min-fresh".equalsIgnoreCase(trim)) {
                    i4 = fvr.ˏ(str2, -1);
                } else if ("only-if-cached".equalsIgnoreCase(trim)) {
                    z5 = true;
                } else if ("no-transform".equalsIgnoreCase(trim)) {
                    z6 = true;
                } else if ("immutable".equalsIgnoreCase(trim)) {
                    z7 = true;
                }
            }
            i5++;
            z8 = z9;
        }
        if (obj == null) {
            ˋ = null;
        } else {
            ˋ = str;
        }
        return new fuc(z8, z, i, i2, z2, z3, z4, i3, i4, z5, z6, z7, ˋ);
    }

    public String toString() {
        String str = this.ˊ;
        if (str != null) {
            return str;
        }
        str = ॱॱ();
        this.ˊ = str;
        return str;
    }

    private String ॱॱ() {
        StringBuilder stringBuilder = new StringBuilder();
        if (this.ˏ) {
            stringBuilder.append("no-cache, ");
        }
        if (this.ॱ) {
            stringBuilder.append("no-store, ");
        }
        if (this.ʻ != -1) {
            stringBuilder.append("max-age=").append(this.ʻ).append(", ");
        }
        if (this.ᐝ != -1) {
            stringBuilder.append("s-maxage=").append(this.ᐝ).append(", ");
        }
        if (this.ॱॱ) {
            stringBuilder.append("private, ");
        }
        if (this.ʽ) {
            stringBuilder.append("public, ");
        }
        if (this.ʼ) {
            stringBuilder.append("must-revalidate, ");
        }
        if (this.ˊॱ != -1) {
            stringBuilder.append("max-stale=").append(this.ˊॱ).append(", ");
        }
        if (this.ˏॱ != -1) {
            stringBuilder.append("min-fresh=").append(this.ˏॱ).append(", ");
        }
        if (this.ॱˊ) {
            stringBuilder.append("only-if-cached, ");
        }
        if (this.ˋॱ) {
            stringBuilder.append("no-transform, ");
        }
        if (this.ͺ) {
            stringBuilder.append("immutable, ");
        }
        if (stringBuilder.length() == 0) {
            return "";
        }
        stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
        return stringBuilder.toString();
    }
}
